混合输入字符串和数字
using namespace std;
int year;
cout << "How old are you!" << endl;
// cin >> year;
// cin.get(); 读取换行符
(cin >> year).get();
char name[20];
cout << "What's your name!" << endl;
cin.getline(name, 20);
cout << "Name :" << name << ",Age :" << year << endl;
🔚